home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / other / fd2pragma / source / include / sdi_defines.h < prev   
C/C++ Source or Header  |  2000-02-28  |  4KB  |  127 lines

  1. #ifndef SDI_DEFINES_H
  2. #define SDI_DEFINES_H
  3.  
  4. /* Includeheader
  5.  
  6.     Name:        SDI_defines
  7.     Versionstring:    $VER: SDI_defines.h 1.31 (17.11.1999)
  8.     Author:        SDI
  9.     Distribution:    PD
  10.     Description:    standard defines and macros and version string
  11.  
  12.  1.17  12.06.96 : RETURN_WARN instead of RETURN_ERROR in SDI_ENDCODE
  13.  1.18  06.07.96 : End: PrintFault behind end --> allows selecting output
  14.  1.19  21.08.96 : added __SASC __AMIGADATE__ support
  15.  1.20  24.08.96 : better SAS-C support
  16.  1.21  04.09.96 : changed error with SAS date having the brackets already
  17.  1.22  18.11.96 : converted to english, C++ comments to C ones
  18.  1.23  02.01.97 : corrected some stuff
  19.  1.24  17.03.97 : removed GetChar and other obsolete defines
  20.  1.25  08.10.97 : renamed defines, removed some defines
  21.  1.26  10.02.98 : made version string const
  22.  1.27  20.02.98 : added compiler independence stuff
  23.  1.28  25.06.98 : compiler independent stuff moved to SDI_compiler.h
  24.  1.29  01.09.98 : fixes for StormC Demo
  25.  1.30  06.05.99 : changed AUTHOR string
  26.  1.31  17.11.99 : date stuff now defaults to __DATE__ for unknown compiler
  27. */
  28.  
  29. #include <exec/types.h>
  30.  
  31. /* ========================= useable defines ============================ */
  32.  
  33. /*
  34.   SDI_ENDCODE        turn on generation of End function
  35.   SDI_ENDCODE_NOCTRLC    use End generation without CTRL_C check
  36.  
  37.   AUTHOR    program author - default is "by SDI"
  38.   DATE        programm creation date - default is automatically created
  39.   DISTRIBUTION    distribution form - default is "(PD) "
  40.   REVISION    revision number - default is "0"
  41.   VERSION    version number - default is "1"
  42. */
  43.  
  44. /* ======================= no need for <stdlib.h> ======================= */
  45.  
  46. #ifdef __cplusplus
  47.   extern "C"
  48. #endif
  49. extern void exit(int);
  50.  
  51. /* ============================ other macros ============================ */
  52.  
  53. /* <proto/exec.h>, <dos/dos.h> */
  54.  
  55. #define CTRL_C        (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
  56.  
  57. /* ================================= SAS C ============================== */
  58.  
  59. #define TestOS if(DOSBase->dl_lib.lib_Version < DosVersion)    \
  60.              exit(RETURN_FAIL)
  61.  
  62. /* A word about variable DosVersion: In my startup code for MaxonC++ I
  63. include use OpenLibrary("dos.library", DosVersion) instead of standard
  64. OpenLibrary("dos.library",0) call. If no DosVersion is given, this
  65. variable defaults to 33, else you can give the value by creating a global
  66. variable ULONG DosVersion = 37;. The program does not start, when the
  67. required DOS is not available. (Better then others, which crash) */
  68.  
  69. /* ===================== version string and EndCode ===================== */
  70.  
  71.  
  72. #ifdef NAME
  73.   #ifndef AUTHOR
  74.     #define AUTHOR "by Dirk Stöcker <stoecker@amigaworld.com>"
  75.   #endif
  76.   #ifndef VERSION
  77.     #define VERSION "1"
  78.   #endif
  79.   #ifndef REVISION
  80.     #define REVISION "0"
  81.   #endif
  82.   #ifndef DATE
  83.     #if defined(__MAXON__) || defined(__STORM__)
  84.       #define SDI_DATE "(" __DATE2__ ")"
  85.     #elif defined(__SASC)
  86.       #define SDI_DATE __AMIGADATE__
  87.     #elif defined(__GNUC__) || defined(__VBCC__)
  88.       #define SDI_DATE "(" __DATE__ ")"
  89.     #else
  90.       #define SDI_DATE "(" __DATE__ ")"
  91.     #endif
  92.   #else
  93.     #define SDI_DATE "(" DATE ")"
  94.   #endif
  95.  
  96.   #ifndef DISTRIBUTION
  97.     #define DISTRIBUTION "(PD) "
  98.   #endif
  99.   const STRPTR version = (STRPTR) "$VER: " NAME " " VERSION "." REVISION " "
  100.   SDI_DATE " " DISTRIBUTION AUTHOR;
  101. #endif /* NAME */
  102.  
  103. #if defined(SDI_ENDCODE) || defined(SDI_ENDCODE_NOCTRLC)
  104.   #include "SDI_compiler.h"
  105.  
  106.   INLINE void end(void);
  107.  
  108.   void End(UBYTE err)
  109.   {
  110.     #ifndef SDI_ENDCODE_NOCTRLC
  111.     if(CTRL_C)
  112.     {
  113.       err = RETURN_WARN;
  114.       SetIoErr(ERROR_BREAK);
  115.     }
  116.     #endif
  117.  
  118.     end();
  119.  
  120.     if(err)        PrintFault(IoErr(), 0);
  121.     exit(err);
  122.   }
  123. #endif /* SDI_ENDCODE && SDI_ENDCODE_NOCTRLC */
  124.  
  125. #endif /* SDI_DEFINES_H */
  126.  
  127.